require(["base", "core-ajax", "swiper", "alertify", "validator", "validator_cn"], function (a, b, c, d) {
    function e() {
        var c = a.Deferred(), e = a.collectData("#loginform");
        return e.force_login = !0, b({
            url: a.apiContext + "login", data: e, type: "post", success: function (b) {
                ticket = b.ticket, a.cookies.set("ticket", ticket), c.resolve(b)
            }, error: function () {
                d.error("登录失败"), c.reject()
            }
        }), c
    }

    var f, g = (a.apiContext, a("#loginform")), h = function () {
        f = new c(".swiper-container", {loop: !0, pagination: ".swiper-bullet", autoplay: 3e3})
    }, i = function () {
        var b = !1;
        alert(a.apiContext);
        g.validator({
            theme: "yellow_top",
            stopOnError: !0,
            focusCleanup: !0,
            timely: !0,
            fields: {name: "required;", password: "required;"}
        }).on("click", "#loginSubmit", function (c) {
            a(c.delegateTarget).trigger("validate"), g.isValid(function (a) {
                a && e().done(function () {
                    b || (d.success("登录成功"), b = !0), setTimeout(function () {
                        window.location.href = "./index.html"
                    }, 1e3)
                })
            })
        })
    }, j = function () {
        i(), h()
    };
    j()
});